<%
layout("/layouts/platform.html"){
%>
<section class="content-wrap bg-white">
    <header class="header navbar bg-white shadow">
    </header>
    <div class=panel-body style="padding-top: 50px;">
        <div class="table-responsive no-border">
            <input id="unitid" type="hidden">
            <table class="table table-bordered table-striped mg-t datatable">
                <thead>
                <tr>
                    <th>参数</th>
                    <th>场景</th>
                    <th>关注个数</th>
            </table>
        </div>
    </div>
</section>
<script language="JavaScript">
    var datatable;
    function initDatatable() {
        datatable = $('.datatable').DataTable({
            "dom": '<"toolbar">frtip',
            "searching":false,
            "processing": false,
            "serverSide": true,
            "select": true,
            "ordering": false,
            "language": {
                "url": "${base}/assets/plugins/datatables/cn.json"
            },
            "preDrawCallback": function () {
                sublime.showLoadingbar($(".main-content"));
            },
            "drawCallback": function () {
                sublime.closeLoadingbar($(".main-content"));
            },
            "ajax": {
                "url": "${base}/platform/sales/QrcodeData",
                "type": "post",
                "data": function (d) {
                }
            },
            "columns": [
                {"data": "qrscene", "bSortable": true},
                {"data": "remark", "bSortable": true},
                {"data": "qrscene", "bSortable": true}
            ],
            "columnDefs": [
                {
                	"render": function (data, type, row) {
                		var num=getNum(data);
                		return num;
                   	 },
                    "targets": 2
              	}
            ]
        });
    }
    $(document).ready(function () {
        initDatatable();
    });
  	//获取客户
    function getNum(qrscene){
  		var num=null;
    	$.ajax({
    		url : "${base}/platform/sales/getQrcodeNum",
    		data : {
    			qrscene : qrscene
    		},
    		type : "post",
    		async : false,
    		dataType : "json",
    		success : function(data){
    			num=data;
    		},
    		error : function(XMLHttpRequest, textStatus, errorThrown) {
    			return false;
    		}
    	});
    	return num;
    }

</script>
<%}%>
